<html>
<head><meta charset="utf-8"><title>std/alloc/core · project-error-handling · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/index.html">project-error-handling</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html">std/alloc/core</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="211827864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211827864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211827864">(Sep 30 2020 at 21:12)</a>:</h4>
<p><span class="user-mention" data-user-id="220273">@Jane Lusby</span> and others: I just spoke with the rest of the Cargo team, and we're definitely willing to help out with questions about build-std and feature flags, if folks here are up for working towards the merge.</p>



<a name="211827895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211827895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211827895">(Sep 30 2020 at 21:12)</a>:</h4>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span> and <span class="user-mention" data-user-id="116015">@Alex Crichton</span> in particular mentioned that they'd be happy to get questions.</p>



<a name="211827924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211827924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211827924">(Sep 30 2020 at 21:12)</a>:</h4>
<p>This is something we've wanted for a <em>long</em> time, and help is deeply welcome.</p>



<a name="211828010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211828010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211828010">(Sep 30 2020 at 21:13)</a>:</h4>
<p>on the bootstrap side I am also happy to answer questions about feasibility/distribution etc</p>



<a name="211828111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211828111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211828111">(Sep 30 2020 at 21:14)</a>:</h4>
<p>I think we're definitely moving towards pushing for a merge <span class="user-mention" data-user-id="239881">@Josh Triplett</span></p>



<a name="211828126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211828126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211828126">(Sep 30 2020 at 21:14)</a>:</h4>
<p>the steps I forsee are</p>



<a name="211828291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211828291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211828291">(Sep 30 2020 at 21:16)</a>:</h4>
<ol>
<li>get a proof of concept for backtrace in core that doesnt' depend on <code>alloc</code> in its current state</li>
<li>stabilize <code>fn backtrace</code> and <code>Backtrace</code> in std (assuming we can later change this to a re-export of core's backtrace type)</li>
<li>merge core/std so that we can resolve the coherence issues around some of the existing trait impls related to the Error trait and make it so that the Error trait is available without alloc in this newly merged <code>std/core/alloc</code></li>
</ol>



<a name="211828334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211828334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211828334">(Sep 30 2020 at 21:16)</a>:</h4>
<p>im assuming that 2 is fine because no matter what when we merge things together that would presumably resolve any issues, assuming there are even any issues about moving things around</p>



<a name="211828343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211828343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211828343">(Sep 30 2020 at 21:16)</a>:</h4>
<p>which I doubt there are given that I think we've done that before</p>



<a name="211828571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211828571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211828571">(Sep 30 2020 at 21:19)</a>:</h4>
<p>that all sounds relatively reasonable</p>



<a name="211828686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211828686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211828686">(Sep 30 2020 at 21:20)</a>:</h4>
<p>I think the major hurdle is going to be chasing down upstream projects that are currently "real" dependencies of std and converting those to <code>#[path = ... ]</code> deps of std, or trying to push on a compiler change that would permit more ergonomic "copy/paste this code in" that doesn't require changes in the upstream logic</p>



<a name="211829772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211829772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211829772">(Sep 30 2020 at 21:30)</a>:</h4>
<p>a couple of my friends have pointed out that they think package local orphan rule violators might be the better approach in the long run</p>



<a name="211829846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211829846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211829846">(Sep 30 2020 at 21:30)</a>:</h4>
<p>where you could group alloc/std/core into one package but as different crates ( i think im not mixing those up) and the orphan rules would be applied to the group rather than each individual crate</p>



<a name="211829883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211829883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211829883">(Sep 30 2020 at 21:31)</a>:</h4>
<p>I'd also be happy to go down this path, I don't really have a strong preference</p>



<a name="211829908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211829908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211829908">(Sep 30 2020 at 21:31)</a>:</h4>
<p>tho the latter approach seems like it might have large benefits downstream as well</p>



<a name="211829929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211829929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211829929">(Sep 30 2020 at 21:31)</a>:</h4>
<p>I also remain unconvinced that literally combining the crates is the way to go here vs. adding a std-only-for-now switch. I think boats had concerns about this approach? I may be misremembering</p>



<a name="211829975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211829975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211829975">(Sep 30 2020 at 21:32)</a>:</h4>
<p>no idea</p>



<a name="211830017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211830017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211830017">(Sep 30 2020 at 21:32)</a>:</h4>
<p>I do think it's going to be quite hard to get the unification to work out nicely, though probably a one-time cost mostly</p>



<a name="211830027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211830027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Manish Goregaokar <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211830027">(Sep 30 2020 at 21:32)</a>:</h4>
<p>Jumping in from an out of band conversation with <span class="user-mention" data-user-id="220273">@Jane Lusby</span> . I have some reservations about merging the stdlibs, and in particular I think motivating it by the orphan rule is a mistake because the problems with the orphan rule here are quite general.</p>
<p>This has been discussed in the past, but, a lot of projects are conceptually "multiple crates, one package", where the "package" is intended to be versioned as a single thing, but is split into many crates to aid in conditional compilation, features, etc. Notably, there are _many_ cases where rust forces you into splitting crates especially when you want to use features, and it ends up being easier to do this. I know that Rain is looking into this kind of thing.</p>
<p>There's a case to be made for local orphan violations within the same package. I've been in situations where i've needed this quite often, and it's one of the main reasons the orphan rules gets annoying -- when it gets in the way where there is _actually no danger_ but it's entirely due to how you chose to slice your code.</p>



<a name="211840761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211840761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211840761">(Sep 30 2020 at 22:17)</a>:</h4>
<p>FWIW, there are multiple other reasons to want to merge the crates; this isn't <em>just</em> about the orphan rule. More generally, there's a desire to be able to compile one crate with feature flags that may be finer-grained than the existing std or alloc.</p>



<a name="211840911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211840911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211840911">(Sep 30 2020 at 22:19)</a>:</h4>
<p>I wouldn't want to see the error-handling project commit everything to making that work as <em>the</em> solution. More that if we agree we <em>want</em> this change anyway, and it's just a matter of implementation effort, then having people who are willing to do the work would help.</p>



<a name="211840994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211840994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211840994">(Sep 30 2020 at 22:20)</a>:</h4>
<p>another example is it'd be great to use simd in libcore, but we it's difficult today because cpu feature detection is in libstd</p>



<a name="211848684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211848684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211848684">(Sep 30 2020 at 22:34)</a>:</h4>
<p>Orphan rule?</p>



<a name="211848855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211848855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211848855">(Sep 30 2020 at 22:36)</a>:</h4>
<p><span class="user-mention" data-user-id="344328">@Charles Ellis O'Riley Jr.</span> If you want to <code>impl SomeTrait for SomeType</code>, you must either be the crate that provides <code>SomeTrait</code> or the crate that provides <code>SomeType</code>, to a first approximation.</p>



<a name="211848877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211848877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211848877">(Sep 30 2020 at 22:36)</a>:</h4>
<p>(It gets a little more complicated with types that have generic parameters, but that's the key concept.)</p>



<a name="211848905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211848905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211848905">(Sep 30 2020 at 22:37)</a>:</h4>
<p>An <code>impl</code> of a trait for a type where you don't own either the trait or the type is called an orphan <code>impl</code>.</p>



<a name="211849276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211849276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211849276">(Sep 30 2020 at 22:42)</a>:</h4>
<p>Josh, first, thank you for the explanation.  Second, I have much to learn.l<span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span>.</p>



<a name="211849482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/211849482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#211849482">(Sep 30 2020 at 22:45)</a>:</h4>
<p>I'm not going to focus on this that much just yet but once we've mostly worked thru the backtrace stabilization issue I think I'll try to go back and create a summary of the problems we're trying to solve and the solutions that are available so we can figure out how we want to move forward to get error into core</p>



<a name="212129353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/212129353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#212129353">(Oct 02 2020 at 21:09)</a>:</h4>
<p>related discussion <a href="#narrow/stream/219381-t-libs/topic/Why.20is.20HashMap.20in.20std.20and.20not.20alloc.3F">https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Why.20is.20HashMap.20in.20std.20and.20not.20alloc.3F</a></p>



<a name="212974504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/212974504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> boats <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#212974504">(Oct 11 2020 at 17:45)</a>:</h4>
<p>We have <em>tons</em> of APIs that want this in std and not all of them are coherence related, some are inherent methods, for example</p>



<a name="212974564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/std/alloc/core/near/212974564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> boats <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/std.2Falloc.2Fcore.html#212974564">(Oct 11 2020 at 17:46)</a>:</h4>
<p>changing the coherence boundary to be larger than the crate would make rust coherence depend on the build system, I'm really not compelled by any proposal to make the language potentially incoherent without cargo</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>